Programming Beyond Practices by Gregory T Brown

Programming Beyond Practices by Gregory T Brown

Author:Gregory T Brown
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2016-10-20T04:00:00+00:00


Student: Make the Supplier sleep for a second before it generates a new widget?

You: That’s a good idea, but we’re working in an asynchronous programming environment. So there isn’t a direct way to tell a process to sleep. Instead, you’d set up some sort of callback to be executed after a set period of delay.

Student: OK, do that then.

You: I would, but it’s not so simple. Right now when order.submit() is called, it immediately triggers a call to supplier.produce(), which returns a Widget. The returned Widget is then pushed into the Crate. If we change supplier.produce() to use an asynchronous callback, it will no longer have a meaningful return value, breaking the whole chain.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.